<!-- 父组件 -->
<template>
  <div id="parent">
    <child></child>
  </div>
</template>

<script>
// 引入子组件Child
import Child from './child'
export default {
  components: { Child },
  data() {
    return {
      name: '张三',
    }
  },
  provide() {
    return {
      name: this.name, // 把name传递给子组件、子路由
    }
  },
}
</script>

<style lang="scss" scoped></style>
